package charpter13.lynx;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Ten {
	static String[] regs = { "^Java", "\\Breg.*", "n.w\\s+h(a|i)s", "s?", "s*",
			"s+", "s{4}", "s{1}", "s{0,3}" };
	public static void main(String[] args) {
		String test = "Java now has regular expressions";
		for (String reg : regs){
			System.out.print(reg + " : ");
			Pattern pattern = Pattern.compile(reg);
			Matcher matcher = pattern.matcher(test);
			while ( matcher.find()) {
				System.out.print(matcher.group(0) +" | ");
			}
			System.out.println();
		}
	}
}
